﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using System.Timers;
using System.Windows;

namespace Trackr
{
	/// <summary>
	/// Interaction logic for App.xaml
	/// </summary>
	public partial class App : Application
	{
		private Timer _defaultTimer = new Timer(10000);
		private Timer _timeOutTimer = new Timer(5000);
		public delegate void TimeElapsedEvent(object sender);
		public event TimeElapsedEvent TimeElapsed;
		public event TimeElapsedEvent TimeOut;

		public string Title { get; set; }
		public App()
		{
			_defaultTimer.Elapsed += (o, _e) =>
			{
				if (TimeElapsed != null)
					TimeElapsed(o);

				_timeOutTimer.Start();
			};
			_timeOutTimer.Elapsed += (oo, _oe) =>
			{
				if (TimeOut != null)
					TimeOut(oo);
			};
			_defaultTimer.Start();
			
		}
		public void StopTimeOutTimer()
		{
			_timeOutTimer.Stop();
		}

		internal void StartTimer()
		{
			_defaultTimer.Start();
		}

		internal void StopTimer()
		{
			_defaultTimer.Stop();
		}
	}
}
